// interface getPaginationspuList

import type { UploadUserFile } from "element-plus";

// 渲染数据的每个对象
export interface spuRecordsobj {
  id: number;
  spuName: string;
  description: string;
  category3Id: number;
  tmId: number;
  spuSaleAttrList: null;
  spuImageList: null;
}

// 渲染数据的数组
export type spuRecordsArray = spuRecordsobj[];

// 返回的总对象
export interface spuRecordsList {
  records: spuRecordsArray;
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}

// 请求参数的类型限制
export interface getspuListts {
  page: number;
  limit: number;
  category3Id: number;
}

export interface getBrandListts {
  id: number;
  tmName: string;
  logoUrl: string;
}

export type getBrandListArray = getBrandListts[];

export interface SalesAttributeobj {
  id: number;
  name: string;
}

export type SalesAttributeArray = SalesAttributeobj[];

export interface spuSaleAttrobjts {
  id: number;
  spuId: number;
  baseSaleAttrId: number;
  saleAttrValueName: string;
  saleAttrName?: string;
  isChecked: null;
}

export type spuSaleAttrListts = spuSaleAttrobjts[];

export interface tablelistobjts {
  id: number;
  isinbushow?: boolean;
  baseSaleAttrId: number;
  saleAttrName: string;
  spuSaleAttrValueList: spuSaleAttrListts;
}

export type tablelistArrayts = tablelistobjts[];

// table 页面的用三级id 和 请求第几页  页数 请求回来渲染的数据
// "records": [
//   {
//     "id": 4546,
//     "spuName": "孙菲菲",
//     "description": "尚硅谷尚硅谷尚硅谷尚硅谷",
//     "category3Id": 1,
//     "tmId": 4,
//     "spuSaleAttrList": null,
//     "spuImageList": null
//   }
// ],
export interface GetSpuRecordsObj {
  id: number;
  spuName: string;
  description: string;
  category3Id: number;
  tmId: number;
  spuSaleAttrList: null;
  spuImageList: null;
}

// SpuFormData
// export interface  SpuFormData  extends Pick<GetSpuRecordsObj,>

export type GetSpuRecordsArray = GetSpuRecordsObj[];

//  spu 添加修改页面品牌下拉框 返回的数据的单个对象
export interface getBrandListObj {
  id: number;
  tmName: string;
  logoUrl: string;
}

//  spu 添加修改页面品牌下拉框 返回的数组的 全部数据的类型定义
export type getBrandListAray = getBrandListObj[];

//  spu 添加修改页面销售属性下拉框 返回的数据是单个对象
export interface SalesAttributeObj {
  id: number;
  name: string;
}

//  spu 添加修改页面销售属性下拉框 返回的数据是一个数组
export type SalesAttributeAray = SalesAttributeObj[];

/*********************  添加spu请求接口的请求参数的ts 类型定义  开始  ****************** */
// 请求spu参数的 图片的单个对象
export interface spuImageObjts {
  imgName: string;
  status: string;
  uid: number;
}
export type spuImageListts = spuImageObjts[];

export interface addspuSaleAttraValueObj {
  baseSaleAttrId: number;
  saleAttrValueName: string;
}

export type addspuSaleAttraValueList = addspuSaleAttraValueObj[];

// 请求参数的销售类型的对象
export interface addspuSaleAttrObj {
  baseSaleAttrId: number;
  saleAttrName: "颜色";
  spuSaleAttraValueList: addspuSaleAttraValueList;
}

//
export type addspuSaleAttrList = addspuSaleAttrObj[];

// 请求添加的ts类型定义
export interface getSpuAddparameter {
  category3Id: number;
  description: string;
  spuImageList: spuImageListts;
  spuName: string;
  spuSaleAttrList: addspuSaleAttrList;
}
/*********************  添加spu请求接口的请求参数的ts 类型定义  结束  ****************** */

/************************* 完整请求参数的ts 类型定义  开始  ***********************/

export interface SpuImageItem {
  id?: number;
  imgName: string;
  imgUrl: string;
}

export type SpuImageList = SpuImageItem[];

export interface SpuSaleAttrValueItem {
  baseSaleAttrId: number;
  id?: number;
  saleAttrValueName: string;
}

export type SpuSaleAttrValueList = SpuSaleAttrValueItem[];

export interface SpuSaleAttrItem {
  baseSaleAttrId: number;
  id?: number;
  isEdit?: boolean;
  saleAttrName: string;
  spuSaleAttrValueList: SpuSaleAttrValueList;
}

export type SpuSaleAttrList = SpuSaleAttrItem[];

export interface SaveOrUpdateSpuApiParams {
  category3Id?: number;
  id?: number;
  spuName: string;
  tmId: number | undefined;
  description: string;
  spuImageList: SpuImageList;
  spuSaleAttrList: SpuSaleAttrList;
}

/************************* 完整请求参数的ts 类型定义  结束  ***********************/

export interface SpuFormData {
  id?: number;
  spuName: string;
  description: string;
  tmId: undefined | number;
  spuImageList: UploadUserFile[];
  spuSaleAttrList: SpuSaleAttrList;
}
